import React from 'react'
import { PageHeaderWrapper } from "@ant-design/pro-layout";
import { Card, Tabs, Button } from 'antd'
import { history } from 'umi';
import Basic from './basic'
import Genre from './genre'
import Media from './media'
import Detail from './detail'
import Presell from './presell'
import Integral from './integral'
import Discount from './discount'
import Ladder from './ladder'
import Distribute from './distribute'

const { TabPane } = Tabs;
export default (props: any) => {
    const { location } = props
    console.log(props);
    const tabList = [
        {
            title: "基础设置",
            com: <Basic />
        },
        {
            title: "商品属性",
            com: <Genre />
        },
        {
            title: "媒体设置",
            com: <Media />
        },
        {
            title: "商品详情",
            com: <Detail />
        },
        {
            title: "预售设置",
            com: <Presell />
        },
        {
            title: "积分设置",
            com: <Integral />
        },
        {
            title: "折扣设置",
            com: <Discount />
        },
        {
            title: "阶梯设置",
            com: <Ladder />
        },
        {
            title: "分销设置",
            com: <Distribute />
        }
    ];

    return (
        <PageHeaderWrapper title={false} style={{ overflow: "hidden" }}>
            <Card style={{ height: "100%" }}>
                <Tabs defaultActiveKey="0" onChange={() => {

                }}>
                    {
                        tabList.map((item, inx: any) => {
                            return (
                                <TabPane tab={item.title} key={inx} style={{ outline: "none", height: "600px", overflowY: "auto" }}>
                                    {item.com}
                                </TabPane>
                            )
                        })
                    }

                </Tabs>,
            <div>
                    <Button type="primary" style={{ marginRight: "5px" }}>保存</Button>
                    <Button onClick={() => {
                        history.push('/goods/list', {
                            page: 2
                        })
                    }}>返回</Button>
                </div>
            </Card>
        </PageHeaderWrapper >
    );
}